Skip to content

Apply BentoBox admin deaths commands to island deaths - #461

Merged
tastybento merged 1 commit into
developfrom
feat/admin-deaths-sync
Sep 26, 2026
Merged

tastybento merged 1 commit into
developfrom
feat/admin-deaths-sync

Conversation

@tastybento

Copy link
Copy Markdown
Member

Why

Discord report: an admin ran /bsbadmin deaths remove <player> 3 ("decreasing the total to 0 deaths"), but /is level still showed (3 deaths). Since 2.29.0 (ff59b02) Level keeps deaths per island and reads BentoBox's per-world counter only once, when it migrates an island. After that, the admin deaths commands had no effect on levels, and Level had no command of its own to change them.

Instead of adding a duplicate Level command, Level now reacts to the BentoBox command.

What

  • New AdminDeathsListener handles PlayerDeathsChangedEvent (Fire PlayerDeathsChangedEvent from admin deaths commands BentoBox#3093) and applies it to every island the player is a member of in that game mode. Islands where they're only trusted or coop are skipped.
  • New LevelsManager methods:
    • addDeaths: adds to the player's count, capped at deaths.max.
    • removeDeaths: takes from the player's count first, then any remainder from the island's anonymous deaths, never below 0.
    • setDeaths (also used for reset): sets the player's count and clears anonymous deaths. The migrated seed lives in the anonymous count, so without this a reset wouldn't fix the reported case. On team islands this also clears deaths left behind by former members; other current members' counts aren't touched.
  • The listener is only registered if the running BentoBox has the event. On older BentoBox, Level logs a note and otherwise works as before.
  • Comments in config.yml and ConfigSettings now describe this behaviour.
  • The BentoBox dependency moves from 3.15.1-SNAPSHOT to 3.23.1-SNAPSHOT.

Merge order

  1. Fire PlayerDeathsChangedEvent from admin deaths commands BentoBox#3093, then a 3.23.1-SNAPSHOT containing it has to be published.
  2. Build with JDK 25 in CI #460, which fixes the ItemsAdder dependency repo (it currently breaks CI on develop).
  3. This PR. CI here will fail until 1 and 2 are done.

Tested locally against a locally published core build: all 267 tests pass, including new LevelsManagerTest cases and AdminDeathsListenerTest.

Release note

Admins need to update both BentoBox and Level for /<admin> deaths to affect island levels.

🤖 Generated with Claude Code

Since deaths became per-island (ff59b02), /<admin> deaths only changed
BentoBox's per-world counter, which Level reads once at migration, so
admins could not change an island's death handicap.

Level now listens for BentoBox's PlayerDeathsChangedEvent and applies the
change to every island the player is a member of in that world:
- add: adds to the player's count (capped at deaths.max)
- remove: takes from the player's count, then from anonymous deaths
- set/reset: sets the player's count and clears anonymous deaths
  (migrated legacy deaths and deaths of former members)

The listener is only registered if the running BentoBox has the event.
Bumps the BentoBox dependency to 3.23.1-SNAPSHOT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tastybento tastybento self-assigned this Sep 26, 2026
@tastybento
tastybento merged commit 9277a15 into develop Sep 26, 2026
1 check failed
@tastybento
tastybento deleted the feat/admin-deaths-sync branch September 26, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant